home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Fading / WhiteFade.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-05  |  1.7 KB  |  54 lines

  1. /* Dice: dcc -l0 -mD dpk.o tags.o WhiteFade.c -o WhiteFade
  2. **
  3. ** There are three examples of fading in this program:  ColourMorph(),
  4. ** ColourToPalette(), and PaletteToColour().  This demo will only work for
  5. ** pictures that make use of a palette table - ie it wouldn't work
  6. ** for a true colour screen.
  7. */
  8.  
  9. #include <proto/dpkernel.h>
  10.  
  11. BYTE *ProgName      = "White Fading Demo";
  12. BYTE *ProgAuthor    = "Paul Manias";
  13. BYTE *ProgDate      = "January 1998";
  14. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  15. BYTE *ProgShort     = "Demonstration of screen fading.";
  16.  
  17. void main(void)
  18. {
  19.   WORD FadeState = 0;
  20.   struct GScreen *screen;
  21.   struct Picture *pic;
  22.   struct FileName PicFile = { ID_FILENAME, "GMS:demos/data/PIC.Loading" };
  23.  
  24.   if (pic = Load(&PicFile, ID_PICTURE)) {
  25.    if (screen = Get(ID_SCREEN)) {
  26.       CopyStructure(pic,screen);
  27.       screen->Bitmap->Palette = NULL;
  28.       screen->Bitmap->Flags   = BMF_BLANKPALETTE;
  29.  
  30.       if (screen = Init(screen,NULL)) {
  31.          if (Copy(pic->Bitmap,screen->Bitmap) IS ERR_OK) {
  32.  
  33.             Display(screen);
  34.  
  35.             do { WaitAVBL();
  36.                  FadeState = ColourMorph(screen,FadeState,10,0,screen->Bitmap->AmtColours,0x000000,0xFFFFFF);
  37.             } while (FadeState != NULL);
  38.  
  39.             do { WaitAVBL();
  40.                  FadeState = ColourToPalette(screen,FadeState,2,0,screen->Bitmap->AmtColours,pic->Bitmap->Palette+2,0xFFFFFF);
  41.             } while (FadeState != NULL);
  42.  
  43.             do { WaitAVBL();
  44.                  FadeState = PaletteToColour(screen,FadeState,2,0,screen->Bitmap->AmtColours,pic->Bitmap->Palette+2,0x000000);
  45.             } while (FadeState != NULL);
  46.          }
  47.       }
  48.    Free(screen);
  49.    }
  50.   Free(pic);
  51.   }
  52. }
  53.  
  54.